#include <iostream>
#define  maxsize 100
int a[maxsize];
using namespace std;

int BinarySearch(int x,int low,int high)
{

    if(low>high)
    {
        return -1;
    }
    int mid=(int)((low+high)/2);
    if(a[mid]==x)
        return x;
    else if(x<a[mid])
    {
         BinarySearch(x,low,mid-1);
    }
    else
    {
         BinarySearch(x,mid+1,high);
    }

}
int main() {
    int n;
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    int x;
    cin>>x;
    cout<<BinarySearch(x,1,n);
    return 0;
}
